<?php
/**
 * Footer Template
 * 
 * @package WP Bootstrap Woo
 */

defined('ABSPATH') || exit;
?>

<!-- footer start -->
<footer id="footer" class="footer-area">
    <div class="footer-main">
        <div class="container">
            <div class="footer-content">
                <div class="row">
                    <div class="col-12 col-lg-4 col-md-6">
                        <div class="footer-wrap footer-about">
                            <div class="footer-logo">
                                <?php if (has_custom_logo()) : ?>
                                    <?php the_custom_logo(); ?>
                                <?php else : ?>
                                    <a href="<?php echo esc_url(home_url('/')); ?>">
                                        <img src="<?php echo get_template_directory_uri(); ?>/assets/images/home1/logo.png" class="img-fluid" alt="<?php bloginfo('name'); ?>">
                                    </a>
                                <?php endif; ?>
                            </div>
                            <div class="footer-info">
                                <p><?php echo get_bloginfo('description'); ?></p>
                                <div class="footer-contact">
                                    <ul class="contact-wrap">
                                        <li class="contact-item">
                                            <div class="contact-icon">
                                                <i class="feather-map-pin"></i>
                                            </div>
                                            <div class="contact-content">
                                                <span><?php echo _xin('contact_address', '123 Main Street, City, Country'); ?></span>
                                            </div>
                                        </li>
                                        <li class="contact-item">
                                            <div class="contact-icon">
                                                <i class="feather-phone"></i>
                                            </div>
                                            <div class="contact-content">
                                                <span><?php echo _xin('contact_phone', '+1 234 567 8900'); ?></span>
                                            </div>
                                        </li>
                                        <li class="contact-item">
                                            <div class="contact-icon">
                                                <i class="feather-mail"></i>
                                            </div>
                                            <div class="contact-content">
                                                <span><?php echo _xin('contact_email',''); ?></span>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-12 col-lg-2 col-md-6">
                        <div class="footer-wrap footer-links">
                            <h4>Quick Links</h4>
                            <ul class="footer-link">
                                <li><a href="<?php echo home_url(); ?>">Home</a></li>
                                <li><a href="#">About Us</a></li>
                                <?php if (class_exists('WooCommerce')) : ?>
                                    <li><a href="<?php echo wc_get_page_permalink('shop'); ?>">Shop</a></li>
                                    <li><a href="<?php echo wc_get_page_permalink('myaccount'); ?>">My Account</a></li>
                                <?php endif; ?>
                                <li><a href="#">Contact</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="col-12 col-lg-2 col-md-6">
                        <div class="footer-wrap footer-links">
                            <h4>Categories</h4>
                            <ul class="footer-link">
                                <?php
                                if (class_exists('WooCommerce')) {
                                    $product_categories = get_terms('product_cat', array(
                                        'hide_empty' => true,
                                        'number' => 5,
                                        'parent' => 0
                                    ));
                                    
                                    if ($product_categories && !is_wp_error($product_categories)) {
                                        foreach ($product_categories as $category) {
                                            echo '<li><a href="' . get_term_link($category) . '">' . esc_html($category->name) . '</a></li>';
                                        }
                                    }
                                } else {
                                    // 默认链接
                                    echo '<li><a href="#">Electronics</a></li>';
                                    echo '<li><a href="#">Fashion</a></li>';
                                    echo '<li><a href="#">Books</a></li>';
                                    echo '<li><a href="#">Sports</a></li>';
                                    echo '<li><a href="#">Home & Garden</a></li>';
                                }
                                ?>
                            </ul>
                        </div>
                    </div>
                    <div class="col-12 col-lg-2 col-md-6">
                        <div class="footer-wrap footer-links">
                            <h4>Customer Service</h4>
                            <ul class="footer-link">
                                <li><a href="#">Help & FAQ</a></li>
                                <li><a href="#">Shipping Info</a></li>
                                <li><a href="#">Returns</a></li>
                                <li><a href="#">Privacy Policy</a></li>
                                <li><a href="#">Terms & Conditions</a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="col-12 col-lg-2 col-md-6">
                        <div class="footer-wrap footer-social">
                            <h4>Follow Us</h4>
                            <div class="footer-social-links">
                                <ul class="social-wrap">
                                    <li><a href="#" target="_blank"><i class="feather-facebook"></i></a></li>
                                    <li><a href="#" target="_blank"><i class="feather-twitter"></i></a></li>
                                    <li><a href="#" target="_blank"><i class="feather-instagram"></i></a></li>
                                    <li><a href="#" target="_blank"><i class="feather-linkedin"></i></a></li>
                                    <li><a href="#" target="_blank"><i class="feather-youtube"></i></a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="footer-bottom">
        <div class="container">
            <div class="footer-bottom-content">
                <div class="row">
                    <div class="col-12 col-md-6">
                        <div class="footer-copyright">
                            <p>&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?>. All rights reserved.</p>
                        </div>
                    </div>
                   
                    <div class="col-12 col-md-6">
                        <div class="footer-payment">
                            <ul class="payment-wrap">
                                <li><img src="<?php echo get_template_directory_uri(); ?>/assets/images/payment/visa.png" class="img-fluid" alt="visa"></li>
                                <li><img src="<?php echo get_template_directory_uri(); ?>/assets/images/payment/mastercard.png" class="img-fluid" alt="mastercard"></li>
                                <li><img src="<?php echo get_template_directory_uri(); ?>/assets/images/payment/paypal.png" class="img-fluid" alt="paypal"></li>
                                <li><img src="<?php echo get_template_directory_uri(); ?>/assets/images/payment/american-express.png" class="img-fluid" alt="american-express"></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</footer>
<!-- footer end -->

<!-- mobile cart drawer start -->
<div class="drawer-container" id="cartDrawer">
    <div class="drawer-overlay"></div>
    <div class="drawer-content">
        <div class="drawer-header">
            <h4>Shopping Cart</h4>
            <button type="button" class="drawer-close"><i class="feather-x"></i></button>
        </div>
        <div class="drawer-body">
            <?php if (class_exists('WooCommerce')) : ?>
                <div class="cart-content">
                    <?php woocommerce_mini_cart(); ?>
                </div>
            <?php else : ?>
                <p>Cart is empty</p>
            <?php endif; ?>
        </div>
    </div>
</div>
<!-- mobile cart drawer end -->

<!-- mobile menu start -->
<div class="mobile-menu-container" id="mobileMenu">
    <div class="mobile-menu-overlay"></div>
    <div class="mobile-menu-content">
        <div class="mobile-menu-header">
            <div class="mobile-menu-logo">
                <?php if (has_custom_logo()) : ?>
                    <?php the_custom_logo(); ?>
                <?php else : ?>
                    <a href="<?php echo esc_url(home_url('/')); ?>">
                        <img src="<?php echo get_template_directory_uri(); ?>/assets/images/home1/logo.png" class="img-fluid" alt="<?php bloginfo('name'); ?>">
                    </a>
                <?php endif; ?>
            </div>
            <button type="button" class="mobile-menu-close"><i class="feather-x"></i></button>
        </div>
        <div class="mobile-menu-body">
            <?php
            if (has_nav_menu('main-menu')) {
                wp_nav_menu(array(
                    'theme_location' => 'main-menu',
                    'menu_class' => 'mobile-menu-list',
                    'container' => false
                ));
            }
            ?>
        </div>
    </div>
</div>
<!-- mobile menu end -->

<!-- scroll to top start -->
<div class="scroll-to-top">
    <a href="#" class="scroll-btn"><i class="feather-arrow-up"></i></a>
</div>
<!-- scroll to top end -->

<?php wp_footer(); ?>

</body>
</html>